package com.anytrek.senior01.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ ClassName UserController
 * @ Author Alex2
 * @ Date 2025/9/6 14:53
 **/
@RestController
@RequestMapping("/users")
public class UserController {

    @Autowired
    private RedisTemplate<Object, Object> redisTemplate;

    // http://localhost:18080/users/testRedis
    @GetMapping("/testRedis")
    public String testRedis() {
        redisTemplate.opsForValue().set("testKey", "hello");
        return redisTemplate.opsForValue().get("testKey").toString();
    }
}
